var moment = require('moment');
module.exports = function(sequelize){
    var Sequelize = require('sequelize');
    var meail = sequelize.define('email',{
        id:{
            type:Sequelize.INTEGER,
            primaryKey:true,
            allowNull:false,
            autoIncrement: true
        },
        from:{
            type:Sequelize.STRING
        },
        to:{
            type:Sequelize.STRING
        },
        title:{
            type:Sequelize.STRING
        },
        time:{
            type:Sequelize.DATE,
            get() {
               return moment(this.getDataValue('time')).format('YYYY-MM-DD HH:mm:ss');
           }
       },
       content:{
        type:Sequelize.STRING
    },
    url:{
        type:Sequelize.STRING
    }
},{
    freezeTableName: true,
    timestamps: false
});
    return meail;
};